﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace November {
    class MappedList<I,O> : IIndexed<O> {
        private List<I> List { get; set; }
        private Func<I, O> Map { get; set; }

        public MappedList(List<I> list, Func<I, O> map) {
            List = list;
            Map = map;
        }

        public Int32 Count {
            get {
                return List.Count;
            }
        }

        public O this[Int32 index] {
            get {
                return Map(List[index]);
            }
        }
    }
}
